package my.ezbart;

import java.util.ArrayList;
import org.xmlvm.iphone.UIApplication;
import org.xmlvm.iphone.UIApplicationDelegate;
import org.xmlvm.iphone.UINavigationController;
import org.xmlvm.iphone.UIScreen;
import org.xmlvm.iphone.UITabBarController;
import org.xmlvm.iphone.UIViewController;
import org.xmlvm.iphone.UIWindow;

/**
 * @author Cecil Holmes
 * @version 0.1
 * 
 * Main.java
 * 
 * Sets up the main navigation flow for the application.
 * 
 * Initializes the TabBar Controller which holds the
 * Navigation Controllers for the main UI screens.
 */
public class Main extends UIApplicationDelegate {
   
   @Override
   public void applicationDidFinishLaunching(UIApplication app) {
       UIWindow window = new UIWindow(UIScreen.mainScreen().getBounds());
       UITabBarController tabController = new UITabBarController();

       TripPlanner tripPlanner = new TripPlanner();
       UINavigationController tp = new UINavigationController(tripPlanner);
       
       SystemMap systemMap = new SystemMap();
       UINavigationController sm = new UINavigationController(systemMap);
       
       RealTimeArrivals realTime = new RealTimeArrivals();
       UINavigationController rt = new UINavigationController(realTime);
       
       MoreInfo moreInfo = new MoreInfo();
       UINavigationController mi = new UINavigationController(moreInfo);
       
       ArrayList<UIViewController> tabs = new ArrayList<UIViewController>();
       tabs.add(tp);
       tabs.add(sm);
       tabs.add(rt);
       tabs.add(mi);
       
       tabController.setViewControllers(tabs);
       
       window.setRootViewController(tabController);
       window.makeKeyAndVisible();
   }

   public static void main(String[] args) {
       UIApplication.main(args, null, Main.class);
   }
}